﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _001基础类学习
{

    class Program
    {
      
        static void Main(string[] args)
        {
            #region //教学
            //通过类创建对象
            //s1对象的引用
            //Student s1 = new Student();//分配内存          
            //s1.SetName("张三");//赋值太随便，应做限制
            //s1.SetAge(200);//赋值太随便，应做限制
            //s1.SetSex("人妖");//赋值太随便，应做限制
            ////输出张三基本信息
            //Console.WriteLine("姓名:{0}",s1.GetName());
            //Console.WriteLine("性别:{0}",s1.GetSex());
            //Console.WriteLine("年龄:{0}",s1.GetAge());
            #endregion
            //第一种初始化数据成员方案
            Person p1 = new Person();
            p1.Name = "张三";
            p1.Sex = "男";
            p1.Age = 20;
            p1.Weight = 65;
            //第二种初始化数据成员方案
            Person p2 = new Person
            {
                Name = "李四",
                Sex = "男",
                Age = 21,
                Weight = 80
            };    
   
            //p1.SayHello(p2.GetName());
            //p2.SayHello(p1.GetName());
            p1.Eat("蛋糕");
            p1.Eat("蛋糕");
            p1.Eat("蛋糕");
            p1.Eat("蛋糕");
            p1.Eat("蛋糕");

            p2.Slim();
            p2.Slim();
            p2.Slim();
            p2.Slim();
            p2.Slim();


        }
    }
}
